package cn.xz.mxxz.adapter

import cn.xz.mxxz.R
import cn.xz.mxxz.bean.AreaList
import cn.xz.mxxz.widgets.XZTextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * 开合屏适配器*/
class OpenTAdapter: BaseQuickAdapter<AreaList, BaseViewHolder>(R.layout.item_open_t) {

    override fun convert(holder: BaseViewHolder, item: AreaList) {
        //只有第一条显示占位图
        if (holder.adapterPosition == 0) {
            holder.setVisible(R.id.view_zw, true)
        } else {
            holder.setGone(R.id.view_zw, true)
        }

        val tvLightTxt = holder.getView<XZTextView>(R.id.tv_area_item)

        if (item.name.toString().length > 10) {
            tvLightTxt.textSize = 10f
        } else {
            tvLightTxt.textSize = 14f
        }

        tvLightTxt.text = item.name.toString()
        tvLightTxt.isSelected = item.select
    }
}